package org.nerve.util;


public class FormatUtil {
	
	/**
	 * 去除HTML标签，如<xxx></xxxx>
	 *	@param base
	 *	@return
	 *  @date: 2013-5-20
	 */
	public static String killHTML(String base){
		String reg = "<.+?>";
		return base.replaceAll(reg, "");
	}
	
	/**
	 * 深度去除html，还有空格，还有换行以及制表符
	 *	@param base
	 *	@return
	 *  @date: 2013-5-20
	 */
	public static String deepKillHTML(String base){
		String reg = "<.+?>";
		return base.replaceAll(reg, "").replaceAll("[\\s*\t\n\r]", "").trim();
	}

	/**
	 * @method name: notNull
	 * @description: 判断一个对象是否为null，如果是字符串，同时也不能为空串
	 * @return type: void
	 *	@param obj
	 *	@param msg
	 *	@throws Exception
	 */
	public static void notNull(Object obj, String msg) throws Exception{
		if(obj == null)
			throw new Exception(msg);
		
		if(obj instanceof String && ((String)obj).trim().length() == 0)
			throw new Exception(msg);
	}
}